<template>
  <view class="content" v-if="item">
    <block>
      <view class="top-img">
        <image :src="this.$store.state.imgBaseUrl + '/join-big-2.png'" v-if="status == 2 || status == 3 || status == 4"></image>
        <image :src="this.$store.state.imgBaseUrl + '/join-big-1.png'" v-else></image>
      </view>
      <view class="r-text">
        <text>
          {{status == 0 ? '店铺已经提交审核' : status == 2 ? '店铺审核驳回' :status == 3 ? '该店铺已下线' : status == 4 ? '店铺审核失败' : '审核成功'}}
        </text>
      </view>
      <view class="hint" v-if="status == 0">
        <view>您提交的店铺认证正在审核中</view>
        <view>我们将尽快处理请耐心等待</view>
      </view>
      <view class="hint" v-else>
        {{statusName}}
      </view>
    </block>
    <view class="footer" v-if="status == 1 || status == 2 || status == 4">
      <button type="primary" class="sub-btn cur" plain="true" @click="draw">重新申请</button>
    </view>
    <view class="footer" v-if="status == 0">
      <button type="primary" class="sub-btn cur" plain="true" @click="gotoHome">我知道了</button>
    </view>
  </view>
</template>

<script>
import { getStoreInfo } from "@/service/storeManage/storeManage.service.js"
export default {
  data() {
    return {
      item: null,
      status: null,
      statusName: null
    };
  },
  onShow() {
    this.getInfo()
  },
  methods: {
    getInfo () {
      getStoreInfo({}, res => {
        if (res.status == 0) {
          if (res.data) {
            this.item = res.data;
            this.status = res.data.status;
            this.statusName = res.data.auditRemark;
            if (res.data.status == 1) {
              uni.redirectTo({
                url: '/pages/storeManage/success'
              });
            }
          } else {
            uni.redirectTo({
              url: '/pages/storeManage/index'
            });
          }
        } else {
          uni.showToast({
            title: res.msg,
            icon: 'none'
          });
        }
      })
    },
    draw () {
      if (this.status == 2) {
        uni.navigateTo({
          url: '/pages/storeManage/index?status=1'
        });
      } else {
        uni.navigateTo({
          url: '/pages/storeManage/index'
        });
      }
    },
    gotoHome () {
      uni.switchTab({
        url: '/pages/index/index'
      })
    }
  }
}
</script>

<style scoped lang="scss">
.content {
  height: 100vh;
  background-color: #FFFFFF;
  padding-top: 27rpx;
}
image {
  width: 100%;
  height: 100%;
}
.result {
  padding-top: 40rpx;
  height: 100vh;
  background-color: #FFFFFF;
}
.top-img {
  padding-top: 60rpx;
  image {
    display: block;
    width: 330rpx;
    height: 330rpx;
    margin: 0 auto 30rpx;
  }
}
.r-text {
  text-align: center;
  font-size: 36rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
}
.hint {
  font-size: 30rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #999999;
  margin-top: 52rpx;
  text-align: center;
  padding: 0 60rpx;
  line-height: 1.6;
}
.icon-list {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 150rpx;
  .box {
    color: #999999;
    font-size: 29rpx;
    image {
      display: block;
      width: 51rpx;
      height: 51rpx;
      margin: 0 auto 25rpx;
    }
    &.over {
      color: #434343;
    }
  }
  .line {
    width: 87rpx;
    height: 1px;
    background: #E1E1E1;
    margin-left: 18rpx;
    margin-right: 29rpx;
  }
}
.footer {
  width: 100%;
  border-top: 1px solid #E1E1E1;
  padding: 14rpx 0 20rpx;
  background-color: #FFFFFF;
  position: absolute;
  bottom: 0;
  left: 0;
  button {
    height: 70rpx;
    margin: 0 32rpx;
    background-color: #636363;
    font-size: 30rpx;
    line-height: 70rpx;
    color: #ADA697;
    border: none;
    &.cur {
      color: #F6DA99;
      background-color: #434343;
    }
  }
}
</style>
